<?php
include('../variables.php');

$lang_file = "../languages/$lang.php";
include($lang_file); 

$connect = mysql_connect($host,$username,$password);
if (!$connect) {
   die('Could not connect: ' . mysql_error());
}
@mysql_select_db($database) or die( "Unable to select database");
?>
<html>
<head>
	<link href="../css/default.css" rel="stylesheet" type="text/css" />
<title>
<? echo $lang_admin_header;?>
</title>
</head>
<body>
<?php include("../includes/header.php"); ?>
	
		<a href="add.php" class="add"><? echo $lang_add_file;?></a>


<ol>
<?
$query = " SELECT * FROM files ORDER BY id DESC";
$result = mysql_query($query) or die('Error, query failed');

if (mysql_num_rows($result) > 0)
{
	// iterate through resultset
	// print title with links to edit and delete scripts
	while($row = mysql_fetch_object($result))
	{
	?>
	<li><strong>
	<? echo $row->paypalname; ?></strong>
	[<a href="../myfiles/<? echo $row->filename; ?>" target="_blank" title="<? echo $lang_view_file;?>"><? echo $row->filename; ?></a>]
	<? echo $lang_currency;?> <? echo $row->price; ?>
	
	<br>
	<font size="-2"><a href="edit.php?id=<? echo $row->id; ?>"><? echo $lang_edit;?></a> 
| <a
href="delete.php?id=<? echo $row->id; ?>"><? echo $lang_delete;?></a></font>
	<p>
	</li>
	<?
	} echo "</ol>";
}
// if no records present
// display message
else
{
?>
	<font size="-1"><? echo $lang_no_downloads;?></font><p>
<?
}

// close connection
mysql_close($connect);

?>
</body>
</html>